package com.example.peanutsubway.service.impl;

import com.example.peanutsubway.dao.impl.ChannelDaoImpl;
import com.example.peanutsubway.entity.Channel;
import com.example.peanutsubway.entity.PageInfo;
import com.example.peanutsubway.service.ChannelService;
import com.example.peanutsubway.vo.ChannelVo;


import java.util.List;

/**
 * @Author：liyangsong
 * @Version：1.0
 * @Date：2021/10/15-11:01
 * @Since:jdk1.8
 * @Description:
 */


public class ChannelServiceImpl implements ChannelService {
    private ChannelDaoImpl channelDao = new ChannelDaoImpl();

    @Override
    public PageInfo showAllChannel(Channel channel, String pageNum, String nowPage) {
        Integer channelcount = channelDao.Channelcount(channel);
        PageInfo page = new PageInfo(nowPage, pageNum, channelcount);
        List<ChannelVo> channels = channelDao.showAllChannel(channel, page);
        page.setDataList(channels);
        return page;
    }

    @Override
    public Boolean addChannel(Channel channel) {
        return channelDao.addChannel(channel);
    }

    @Override
    public Boolean addAdress(String downloadAdress, Integer id) {
        return channelDao.addAdress(downloadAdress,id);
    }

    @Override
    public Boolean deteleAdress(Integer id) {
        return channelDao.deteleAdress(id);
    }
}
